#include <QCoreApplication>
#include <QtConcurrent>
#include <QThread>
#include <QThreadPool>
#include <QDebug>
#include <QString>
#include <QFutureWatcher>

int multiply(const int &value)
{
    qInfo() << "Called" << value;
    int num = value * 10;
    return num;
}

int main(int argc, char *argv[])
{

    QCoreApplication a(argc, argv);
    QThread::currentThread()->setObjectName("Main");

    QList<int> list;
    for(int i = 0;i < 100;i++)
    {
        list.append(i);
    }

    QFutureWatcher<int> watcher;
    QFuture<int> future = QtConcurrent::mapped(list,&multiply);
    watcher.setFuture(future);
    //set signals and slots here

    watcher.waitForFinished(); //Blocking
    qInfo() << "Done";
    qInfo() << future.results();


    return a.exec();
}
